home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGSCAL / TURBOK50.LZH / SOURCE.ARC / WINTTT5.ASM < prev    next >
Assembly Source File  |  1989-01-17  |  7KB  |  167 lines

  1. ;{--------------------------------------------------------------------------}
  2. ;{                         TechnoJock's Turbo Toolkit                       }
  3. ;{                                                                          }
  4. ;{                              Version G 5.00                              }
  5. ;{                                                                          }
  6. ;{                                                                          }
  7. ;{             Copyright (c) 1986-89 TechnoJock Software Inc.               }
  8. ;{                     All Rights Reserved - Worldwide                      }
  9. ;{--------------------------------------------------------------------------}
  10. ;
  11. ;                     {-------------------------------}                                       
  12. ;                     {       OBJ:   WinTTT5          }
  13. ;                     {-------------------------------}
  14. ;
  15. ;
  16.  
  17. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  18. ;+                                                                + 
  19. ;+          This asm file contains 2 pascal procedures for        +  
  20. ;+          linking with TTT version 5.0. The procedures are:     +
  21. ;+                                                                +
  22. ;+           MoveFromScreen(var Source, Dest; Length : Word);     +
  23. ;+           MoveToScreen(var Source, Dest; Length : Word);       +
  24. ;+                                                                + 
  25. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  26.  
  27.  
  28. DATA    SEGMENT BYTE PUBLIC
  29.  
  30.         EXTRN   SnowProne : BYTE
  31.  
  32. DATA    ENDS
  33.  
  34.  
  35. CODE    SEGMENT BYTE PUBLIC
  36.  
  37.         ASSUME  CS:CODE,DS:DATA
  38.  
  39.         PUBLIC  MoveFromScreen, MoveToScreen
  40.  
  41. ;+++++++++++++++++++++++++++++++++++++++
  42. ;+     M O V E F R O M S C R E E N     +
  43. ;+++++++++++++++++++++++++++++++++++++++
  44.  
  45. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  46. ;+                                                                +
  47. ;+    Move data from screen to DEST without snow. Note that       +
  48. ;+    the length is in WORDS not bytes.                           +
  49. ;+                                                                +
  50. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  51.  
  52.  
  53. MFLength        EQU     WORD PTR [BP+6]
  54. MFDest          EQU     DWORD PTR [BP+8]
  55. MFSource        EQU     DWORD PTR [BP+12]
  56.  
  57. MoveFromScreen  PROC FAR
  58.  
  59.         PUSH    BP                      ;Save BP
  60.         MOV     BP,SP                   ;Set up stack frame
  61.         MOV     BX,DS                   ;Save DS in BX
  62.         MOV     AL,Snowprone            ;Grab before changing DS
  63.         LES     DI,MFDest               ;ES:DI points to Dest
  64.         LDS     SI,MFSource             ;DS:SI points to Source
  65.         MOV     CX,MFLength             ;CX = Length
  66.         CLD                             ;Set direction to forward
  67.         RCR     AL,1                    ;Check WaitForRetrace
  68.         JNC     MFNoWait                ;False? Use MFNoWait routine
  69.         MOV     DX,03DAh                ;Point DX to CGA status port
  70. MFNext:
  71.         CLI                             ;No interrupts now
  72. MFWaitNoH:
  73.         IN      AL,DX                   ;Get 6845 status
  74.         TEST    AL,8                    ;Check for vertical retrace
  75.         JNZ     MFGo                    ;In progress? go
  76.         RCR     AL,1                    ;Wait for end of horizontal
  77.         JC      MFWaitNoH               ; retrace
  78. MFWaitH:
  79.         IN      AL,DX                   ;Get 6845 status again
  80.         RCR     AL,1                    ;Wait for horizontal
  81.         JNC     MFWaitH                 ; retrace
  82. MFGo:
  83.         LODSW                           ;Load next video word into AX
  84.         STI                             ;Allow interrupts
  85.         STOSW                           ;Store video word in Dest
  86.         LOOP    MFNext                  ;Get next video word
  87.         JMP     MFExit                  ;All Done
  88. MFNoWait:
  89.         REP     MOVSW                   ;That's it!
  90. MFExit:
  91.         MOV     DS,BX                   ;Restore DS
  92.         MOV     SP,BP                   ;Restore SP
  93.         POP     BP                      ;Restore BP
  94.         RET     10                      ;Remove parameters and return
  95.  
  96. MoveFromScreen  ENDP
  97.  
  98. ;+++++++++++++++++++++++++++++++++++
  99. ;+     M O V E T O S C R E E N     +
  100. ;+++++++++++++++++++++++++++++++++++
  101.  
  102. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  103. ;+                                                                +
  104. ;+    Move data from SOURCE to DEST without snow. Note that       +
  105. ;+    the length is in WORDS not bytes.                           +
  106. ;+                                                                +
  107. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  108.  
  109.  
  110. ;****************************************************** MoveToScreen
  111.  
  112. ;procedure MoveToScreen(var Source, Dest; Length : Word);
  113. ;Move Length words from Source to Dest (video memory) without snow
  114.  
  115. ;equates for parameters:
  116. MTLength        EQU     WORD PTR [BP+6]
  117. MTDest          EQU     DWORD PTR [BP+8]
  118. MTSource        EQU     DWORD PTR [BP+12]
  119.  
  120. MoveToScreen    PROC FAR
  121.  
  122.         PUSH    BP                      ;Save BP
  123.         MOV     BP,SP                   ;Set up stack frame
  124.         PUSH    DS                      ;Save DS
  125.         MOV     AL,SnowProne            ;Grab before changing DS
  126.         LES     DI,MTDest               ;ES:DI points to Dest
  127.         LDS     SI,MTSource             ;DS:SI points to Source
  128.         MOV     CX,MTLength             ;CX = Length
  129.         CLD                             ;Set direction to forward
  130.         RCR     AL,1                    ;Check WaitForRetrace
  131.         JNC     MTNoWait                ;False? Use MTNoWait routine
  132.         MOV     DX,03DAh                ;Point DX to CGA status port
  133. MTGetNext:
  134.         LODSW                           ;Load next video word into AX
  135.         MOV     BX,AX                   ;Store video word in BX
  136.         CLI                             ;No interrupts now
  137. MTWaitNoH:
  138.         IN      AL,DX                   ;Get 6845 status
  139.         TEST    AL,8                    ;Check for vertical retrace
  140.         JNZ     MTGo                    ;In progress? Go
  141.         RCR     AL,1                    ;Wait for end of horizontal
  142.         JC      MTWaitNoH               ; retrace
  143. MTWaitH:
  144.         IN      AL,DX                   ;Get 6845 status again
  145.         RCR     AL,1                    ;Wait for horizontal
  146.         JNC     MTWaitH                 ; retrace
  147. MTGo:
  148.         MOV     AX,BX                   ;Move word back to AX...
  149.         STOSW                           ; and then to screen
  150.         STI                             ;Allow interrupts
  151.         LOOP    MTGetNext               ;Get next video word
  152.         JMP     MTExit                  ;All done
  153. MTNoWait:
  154.         REP     MOVSW                   ;That's all!
  155. MTExit:
  156.         POP     DS                      ;Restore DS
  157.         MOV     SP,BP                   ;Restore SP
  158.         POP     BP                      ;Restore BP
  159.         RET     10                      ;Remove parameters and return
  160.  
  161. MoveToScreen    ENDP
  162.  
  163. CODE    ENDS
  164.  
  165.         END
  166.  
  167.